import request from '../utils/api'

// 获取信号采集列表
export const getSignalCollectionList = (params) => {
  return request({
    url: '/signalCollection/list',
    method: 'get',
    params
  })
}

// 获取信号采集详情
export const getSignalCollectionDetail = (id) => {
  return request({
    url: `/signalCollection/${id}`,
    method: 'get'
  })
}

// 添加信号采集记录
export const addSignalCollection = (data) => {
  return request({
    url: '/signalCollection',
    method: 'post',
    data
  })
}

// 更新信号采集记录
export const updateSignalCollection = (data) => {
  return request({
    url: `/signalCollection/${data.id}`,
    method: 'put',
    data
  })
}

// 删除信号采集记录
export const deleteSignalCollection = (id) => {
  return request({
    url: `/signalCollection/${id}`,
    method: 'delete'
  })
}

// 批量删除信号采集记录
export const batchDeleteSignalCollections = (ids) => {
  return request({
    url: '/signalCollection/batch',
    method: 'delete',
    params: { ids: ids.join(',') }
  })
}

// 获取信号统计信息
export const getSignalStats = () => {
  return request({
    url: '/signalCollection/stats',
    method: 'get'
  })
}

// 获取设备信号趋势数据
export const getDeviceSignalTrend = (deviceId, days = 7) => {
  return request({
    url: `/signalCollection/trend/${deviceId}`,
    method: 'get',
    params: { days }
  })
}

// 随机插入信号数据
export const addRandomSignalData = (count = 1) => {
  return request({
    url: '/signalCollection/random',
    method: 'post',
    params: { count }
  })
}